package com.shixi.shixitraining.shixitraining.ui.tabhome.adapter;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.shixi.shixitraining.shixitraining.ui.tabhome.entity.AuthenBean;
import com.shixi.shixitraining.shixitraining.ui.tabhome.fragment.CourseDescriptionFragment;
import com.shixi.shixitraining.shixitraining.ui.tabhome.fragment.CourseOutlineFragment;
import com.shixi.shixitraining.shixitraining.ui.tabhome.fragment.CourseParamsFragment;
import com.shixi.shixitraining.shixitraining.ui.tabhome.fragment.TeacherIntroduceFragment;

/**
 * Created by shenyan on 2018/8/15.
 */

public class AuthenDetailPagerAdapter extends FragmentPagerAdapter {

    private String []  titles={"课程参数","课程介绍","课程大纲","名师介绍"};

private AuthenBean mData;
    public AuthenDetailPagerAdapter(FragmentManager fm,AuthenBean bean) {
        super(fm);
        this.mData=bean;
    }


    Fragment fragment;

    @Override
    public Fragment getItem(int position) {
        Bundle bundle=new Bundle();
        bundle.putSerializable("bean",mData);
        if (titles[position].equals("课程参数")){
            fragment=new CourseParamsFragment();
        }else if (titles[position].equals("课程介绍")){
            fragment=new CourseDescriptionFragment();
        }else if (titles[position].equals("课程大纲")){
            fragment=new CourseOutlineFragment();
        }else if (titles[position].equals("名师介绍")){
            fragment=new TeacherIntroduceFragment();
        }
        fragment.setArguments(bundle);
        return fragment;
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }


}
